﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Product.Master" Inherits="System.Web.Mvc.ViewPage<QuestionInputModels>" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<%@ Import Namespace="SDT.Site.ViewModels" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%=Model.Question!=null? Html.Encode(Model.Question.Title): string.Empty %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script src="/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<div class="question">
        <div class="">
        <div style="overflow: hidden;">
            <% if (Model.Question != null)
            { %>
            <div style="display: block; overflow: hidden;">
                <div class="intro">
                    <h3>
                        <a title="<%= Model.Question.Title %>" href="#"><span class="name">
                            <%= Model.Question.Title%></span> </a>
                    </h3>
                    <div class="content">
                        <span class="author">Người gửi: <strong>
                            <%= Model.Question.AddBy.HasValue ? Model.Question.aspnet_User.UserName : Model.Question.SendBy%></strong>
                            | Thời gian gửi:
                            <%= Model.Question.AddDate%></span> <span class="mores">Trong: <a href="#" style="color: #1C7B9B;">
                                <%= Model.Question.CatID.HasValue ? Model.Question.QuestionCategory.Name : "Khác"%></a>
                            | Trả lời: (<a title="<%= Model.Question.Title %>" href="#"
                                class="answer" style="color: #1C7B9B;"><%= Model.Question.nPubAnswers%></a>) | Lần
                                xem: (<label style="color: black;"><%= Model.Question.nViews%></label>)
                        </span>
                    </div>
                </div>
            </div>
            <div class="listdetail">
                <h4>
                    <label>
                        Chi tiết câu hỏi
                    </label>
                </h4>
                <span id="listcontent">
                    <p>
                        <%= Model.Question.QuestionContent%></p>
                </span>
            </div>
            <%} %>
        </div>
        <div id="reply">
            <h3 style="color: #1C7D9D; text-align: center; margin: 5px 0px; cursor: pointer;">
                <a href="#reply">Trả lời câu hỏi này</a></h3>
        </div>
        <div style="margin-left: 4px;" id="divReply">
            <form name="reply" action="/question/answer" method="post" id="replyForm">
            <div id="_PersonalInfor" style="display: block;">
                <div style="width: 50%; float: left; text-align: left;">
                    <h4 style="margin: 8px 0px;">
                        Tên liên hệ&nbsp;(<span style="color: Red;">*</span>)</h4>
                    <%= Html.TextBoxFor(m => m.Answer.AnswerName, new { @class = "required", @style = "width: 95%;" })%>
                </div>
                <div style="width: 50%; float: right; text-align: left;">
                    <h4 style="margin: 8px 0px;">
                        Email&nbsp;(<span style="color: Red;">*</span>)</h4>
                    <%= Html.TextBoxFor(m => m.Answer.AnswerEmail, new { @class = "required email", @style = "width: 95%;" })%>
                </div>
            </div>
            <div style="clear: both; padding-top: 10px;">
                <%= Html.TextAreaFor(m=>m.Answer.Answers, new { style="width:680px; height:200px" })%>
            </div>
            <script language="javascript" type="text/javascript">
                $(document).ready(function() {
                    $("#replyForm").validate({
                        rules: {
                            "Answer.AnswerName": "required",
                            "Answer.AnswerEmail": "required"
                        },
                        messages: {
                            "Answer.AnswerName": "Trường này là bắt buộc, vui lòng nhập dữ liệu!",
                            "Answer.AnswerEmail": "Trường này là bắt buộc, vui lòng nhập dữ liệu!"
                        }
                    });
                });                       
                tinyMCE.init({
                    mode: "exact",
                    plugins: "paste,imagemanager",
                    theme: "advanced",
                    elements: "Answer_Answers",
                    theme_advanced_buttons1: "pastetext,separator,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
                    theme_advanced_buttons2: "",
                    theme_advanced_buttons3: "",
                    theme_advanced_toolbar_location: "top",
                    theme_advanced_toolbar_align: "left",
                    theme_advanced_statusbar_location: "bottom",
                    paste_use_dialog: false,
                    paste_auto_cleanup_on_paste: true,
                    paste_convert_headers_to_strong: false,
                    paste_strip_class_attributes: "all",
                    paste_remove_spans: true,
                    paste_remove_styles: true
                });
            </script>

            <p style="text-align: center; margin: 10px 0px;">
                <%= Html.Hidden("Answer.QuestionID", Model.Question.ID) %>
                <input type="submit" value="Gửi" class="bnt_short" />
            </p>
            </form>
        </div>
        </div>
        <div class="question_as">
            <div class="q1">
                <div class="q11">
                    <h3 style="color: White;">
                        Danh sách câu trả lời (<%= Model.Question.nPubAnswers %>)</h3>
                </div>
                <div class="q12">
                    &nbsp;</div>
                <div class="q13">
                    &nbsp;</div>
            </div>
            <div style="width: 582px;">
                <% if (Model.ListAnswer != null && Model.ListAnswer.Count() > 0)
                   {%>
                <ul>
                    <%
                       foreach (var a in Model.ListAnswer)
                       {
                    %>
                    <li class="line_dot">
                        <div style="margin: 10px 0px 20px 0px;">
                            Trả lời bởi: <b>
                                <%= a.AddBy.HasValue? a.aspnet_User.UserName: a.AnswerName %></b>, vào lúc :
                            <%= a.AddDate %></div>
                        <div class="detail">
                            <%= a.Answers %>
                        </div>
                    </li>
                    <%}%>
                </ul>
                <%
                   }%>
            </div>
            <div class="clear"></div>
                <div class="pagebarUTH f_r">
                    <% if (Model.ListAnswer != null && Model.ListAnswer.Count()>0)
                       { %>
                    <%= Html.Pager(Model.ListAnswer.PageSize, Model.ListAnswer.PageNumber, Model.ListAnswer.TotalItemCount)%>
                    <%} %>
                </div>
        </div>
</div>
  <div class="clear"></div>  
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="RightContent" runat="server">
    <% Html.RenderAction("Lasted", "QuestionCategory", new { id = Model.Question.QuestionCategory != null ? Model.Question.QuestionCategory.ID : 0, title = "Chuyên mục hỏi đáp" }); %>
    <% Html.RenderAction("Lasted", "Question", new { catid = Model.Question.QuestionCategory != null ? Model.Question.QuestionCategory.ID : 0, title = "Hỏi đáp được quan tâm" }); %>
    <div class="clear" style="margin-top:5px"></div>
    <% Html.RenderAction("Newsest", "Question", new { catid = Model.Question.QuestionCategory != null ? Model.Question.QuestionCategory.ID : 0, title = "Hỏi đáp mới nhất" }); %>
</asp:Content>
